package com.secondary.interceptor;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.secondary.pojos.Administrator;

public class AdministratorInterceptor extends AbstractInterceptor{

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		ActionContext ctx = invocation.getInvocationContext();  
        Map session = ctx.getSession();  
        Administrator admin = (Administrator) session.get("admin");  
        if(admin!=null){
        	return invocation.invoke(); 
        }
		return "adminLogin";
	}
}
